// JavaScript Document
function onReadyState()
{
	var data=null;
	if (req.readyState==READY_STATE_COMPLETE)
	{
		var xmlDoc = req.responseText; //receives the response text from back page
		var pos=xmlDoc.indexOf('^');
		var len=xmlDoc.length;
		var content=xmlDoc.substring(0,pos);
		var num=xmlDoc.substring(pos+1,len);
		
		//alert(xmlDoc);
		
		num1=num.split('&');
		//alert(num);
		if(num==1)
		{

			var srcObj1=document.getElementById('stateId');
			srcObj1.options.length = 0 ;
	
			var statelist=content.split("_");
			//alert(statelist.length);
			for(i=0;i<statelist.length;i++)
			{
			var stateId=statelist[i].split(",");
			//alert("stId "+stateId[0]);
			document.getElementById('stateId').options[i]=new Option(stateId[1],stateId[0]);
			}
		}
		if(num1[0]==2)
		{
		document.getElementById('quality_rate').innerHTML=content;
		document.getElementById('msg_quality').innerHTML=num1[1];	
		}
		if(num1[0]==3)
		{
		document.getElementById('pertinence_rate').innerHTML=content;
		document.getElementById('msg_pertinence').innerHTML=num1[1];	
		}
		if(num1[0]==4)
		{
		var srcObj1=document.getElementById('position');
			srcObj1.options.length = 0 ;
	
			var positionlist=content.split("_");

			for(i=0;i<positionlist.length;i++)
			{
				var position=positionlist[i].split(",");
				document.getElementById('position').options[i]=new Option(position[1],position[0]);
			}
		}
		else if(num==5)
		{
			document.getElementById('searchoption').style.display='';
			document.getElementById('searchoption').innerHTML = content;
		}
	}
}
